#pragma once
#include "RBTree1.h"
template<class K>
class mySet {
public:
	struct SetKeyOfT {
		const K& operator()(const K& k) {
			return k;
		}
	};
	typedef typename RBTree<K, K, SetKeyOfT>::iterator iterator;
	iterator begin() {
		return _rt.begin();
	}
	iterator end() {
		return _rt.end();
	}
	pair<iterator,bool> insert(const K& key) {
		return _rt.Insert(key);
	}
	iterator find(const K& key) {
		return _rt.Find();
	}
	size_t size() {
		return _rt.Size();
	}
private:
	RBTree<K, K, SetKeyOfT> _rt;
};
void test_MySet() {
	mySet<int> ms;
	int a[] = { 7,4,1,8,5,2,9,6,3 };
	for (auto e : a) {
		ms.insert(e);
	}
	mySet<int>::iterator it = ms.begin();
	while (it != ms.end()) {
		cout << *it << " ";
		++it;
	}
	cout << endl;
	cout << "size:" << ms.size() << endl;
}